/**
 * This file is part of the CAKIS project.
 * 
 * Copyright (c) 2009-2010 - Florian Arndt, Christian Kerl
 * 
 * @license GNU Lesser General Public License v3 <http://www.opensource.org/licenses/lgpl-3.0.html>
 * @since   30.03.2010
 * @version SVN: $Id: JUnitSeamTestSuiteRunner.java 63 2010-04-11 12:44:46Z christian-kerl@web.de $
 */
package org.cakis.server;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 * Superclass for running Seam integration tests in batch mode. This
 * class does n o t extend JUnitSeamTest but instead creates an instance
 * to start and stop the container at the beginning and the end of the
 * processing and to set the batch flag.
 * 
 * The subclass must only assign the @SuiteClasses({x.class, y.class})
 * annotation.
 * 
 * @author Rainer Schön
 * @see http://seamframework.org/Community/SeamIntegrationTestsWithJUnit
 */

@RunWith(Suite.class) // JUnit batch runner
public class JUnitSeamTestSuiteRunner {
    private static JUnitSeamTest seamTest = new JUnitSeamTest();

    @BeforeClass
    public static  void setUpBeforeClass() throws Exception {
        // set the flag to signal batch mode
        seamTest.setBatch(true);
        seamTest.startContainer();
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
        seamTest.stopContainer();
        seamTest.setBatch(false);
    }
}
